﻿using RS.BaseModel.Entity;
using RS.Environment;
using RS.Tool.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaseAuthRole.DTO.User
{
   public class UUIUserAuthToken: BaseEntity
    {
        public string AuthToken { get; set; }

        public string Uid { get; set; }
        /// <summary>
        /// 用户对外的数字ID
        /// </summary>
        public string UserUniqueId { get; set; }
        public string AppId { get; set; }

        public string AuthType { get; set; }

        public string AuthCode { get; set; }

        public DateTime AddTime { get; set; }

        public DateTime ExpireTime { get; set; }

        public UUIUserAuthToken()
        {
          

            ExpireTime =DateTime.Now.AddSeconds(Int32.Parse(ConfigurationHelper.GetAppSettings("UserAuthTokenExpire")));

        }

        public void SetAuthToken() {

            this.AuthToken = "at_" + SecretHelper.GetMD5(this.Uid) + "_" + Guid.NewGuid().ToString("N");
        }
    }
}
